package com.xishu.config;

import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.ThreadContext;

import java.util.Arrays;
import java.util.List;

public class Constant {
    public static final String RESOURCE_PATH = "/runtime/dola/service/be/resource/";

    public static final String LOGO_FILE_ID = "602a80a6a792c80ac2ebeb9d.jpg";

    /**
     * HTTP STATUS
     */
    public static final int HTTP_STATUS_OK = 200;

    /**
     * 会话级用户
     */
    public static final String SESSION_USER = "session.user";

    public static final String SESSION_USER_ID = "session.user.id";

    public static final String SESSION_TOKEN = "session.token";

    public static final String CUSTOMER_REQUEST = "customerRequest";

    public static final String SESSION_CUSTOMER = "session.customer.id";


    /**
     * 请求ID
     */
    public static final String REQUEST_ID = "requestId";
    public static final String SESSION_ID = "session.id";
    public static final String FE_REQUEST = "fe.request";

    //用户状态OK
    public static final int USER_STATUS_OK = 0;

    //用户已锁定
    public static final int USER_STATUS_LOCK = 1;

    public static final int SEARCH_ALL_PAGE_SIZE = 9999;

    public static final String DATA_SOURCE_DOLA = "dola";

    public static final String DATA_SOURCE_XISHU = "xishu";

    public static final String DATA_SOURCE_STANDBY = "standby";

    public static final int ONE_DB_TABLE_SIZE = 1000;

    public static final int PROVINCE_LEVEL = 1;
    public static final int CITY_LEVEL = 2;
    public static final int COUNTY_LEVEL = 3;

    public static final long USER_ROLE_COMPANY = 3;


    public static final String MODIFY_PASSWORD = "modify.password";

    public static final String CUSTOMER_RANDOM_CODE_VALID = "customer.random.code.valid";

    //非法的价格
    public static final double INVALID_ITEM_PRICE = -1d;

    //堂食，扫码桌面二维码或者是服务员开台,或者是扫描拼台的二维码
    public static final int ORDER_TYPE_TANG_SHI = 1;
    //外卖
    public static final int ORDER_TYPE_TAKE_OUT = 2;
    //外卖平台
    public static final int ORDER_TYPE_TAKE_OUT_PLAT = 3;
    //快餐，有堂食二维码点餐，也可以是服务员点的堂食
    public static final int ORDER_TYPE_QUICK_FOOD = 4;

    public static final String RESET_PASSWORD_EMAIL = "reset.password.email";

    public static final int SORT_ROW = 1;
    public static final int SORT_COLUMN = 2;

    public static final String SEPERATOR_KEY = ":";

    //订单状态
    @ApiModelProperty(value = "订单状态, 100是已完成，99是待支付，1是正在点餐，2是个人结账，3是正在设置分钱结账，4是正在设置分菜结账，5是按人数分钱结账，6是自定义分线结账，7是分菜结账，8是已经有一部分人分钱结账已付款，9是已经有一部分人分菜结账已付款,10自定义分钱结账，部分付款")
    public static final int ORDER_STATUS_STARTING = 1;
    public static final int ORDER_STATUS_ONE_PERSON_PAYING = 2;
    public static final int ORDER_STATUS_SETTING_PART_CASH = 3;
    public static final int ORDER_STATUS_SETTING_PART_FOOD = 4;
    public static final int ORDER_STATUS_PART_CASH = 5;
    public static final int ORDER_STATUS_PART_CASH_CUSTOMIZED = 6;
    public static final int ORDER_STATUS_PART_FOOD = 7;
    public static final int ORDER_STATUS_PART_CASH_PAYED = 8;
    public static final int ORDER_STATUS_PART_FOOD_PAYED = 9;
    public static final int ORDER_STATUS_PART_CASH_CUSTOMIZED_PAYED = 10;
    //订单已取消
    public static final int ORDER_STATUS_CANCELED = 50;
    //外卖平台的订单，待接单
    public static final int ORDER_STATUS_TAKE_OUT_PENDING = 80;
    //外卖平台的订单，已接单
    public static final int ORDER_STATUS_TAKE_OUT_TAKING = 81;

    //支付订单已取消
    public static final int ORDER_STATUS_CANCEL = 98;
    //支付订单状态，待支付
    public static final int ORDER_STATUS_PENDING_PAY = 99;
    public static final int ORDER_STATUS_END = 100;

    public static final List<Integer> ORDER_PROCESSING_STATUS_LIST = Arrays.asList(ORDER_STATUS_STARTING, ORDER_STATUS_ONE_PERSON_PAYING, ORDER_STATUS_SETTING_PART_CASH,
            ORDER_STATUS_PART_CASH, ORDER_STATUS_PART_FOOD, ORDER_STATUS_PART_CASH_PAYED, ORDER_STATUS_PART_FOOD_PAYED, ORDER_STATUS_PART_CASH_CUSTOMIZED, ORDER_STATUS_SETTING_PART_FOOD);

    public static final List<Integer> ORDER_PART_PAY_STATUS_LIST = Arrays.asList(ORDER_STATUS_PART_CASH_PAYED, ORDER_STATUS_PART_FOOD_PAYED, ORDER_STATUS_PART_CASH_CUSTOMIZED_PAYED);

    public static final List<Integer> ORDER_UN_PAY_STATUS_LIST = Arrays.asList(ORDER_STATUS_STARTING, ORDER_STATUS_ONE_PERSON_PAYING, ORDER_STATUS_SETTING_PART_CASH, ORDER_STATUS_SETTING_PART_FOOD, ORDER_STATUS_PART_CASH, ORDER_STATUS_PART_FOOD, ORDER_STATUS_PART_CASH_CUSTOMIZED);


    //@ApiModelProperty(value = "订单类型, 1个人结账，2分钱结账，3分菜结账")
    public static final int PAY_TYPE_ONE_USER = 1;
    public static final int PAY_TYPE_PART_CASH = 2;
    public static final int PAY_TYPE_PART_FOOD = 3;


    //@ApiModelProperty(value = "选择的付款方式，1是单独结账，2是分钱结账按人数来算，3是分钱结账自定义金额，4是分菜结账")
    public static final int USER_SELECT_PAY_TYPE_ONE_USER = 1;
    public static final int USER_SELECT_PAY_TYPE_PART_CASH_PER_PERSON = 2;
    public static final int USER_SELECT_PAY_TYPE_PART_CASH_CUSTOMIZED = 3;
    public static final int USER_SELECT_PAY_TYPE_PART_FOOD = 4;

    //    @ApiModelProperty(name = "状态, 1空桌，2是就餐中，3已部分买单,4已部分发送，5已付款")
    public static final int FOOD_TABLE_STATUS_EMPTY = 1;
    public static final int FOOD_TABLE_STATUS_EATING = 2;
    public static final int FOOD_TABLE_STATUS_PART_CASH = 3;
    public static final int FOOD_TABLE_STATUS_PART_SEND = 4;
    public static final int FOOD_TABLE_STATUS_PAYED = 5;


    //反馈的状态
    public static final int FEED_BACK_STATUS_INIT = 1;

    //   "0是服务员餐桌二维码,B端控制主页上餐桌点单，" +
    public static final int RUN_MODEL_TYPE_FOOD_TABLE = 0;
    //   "1是总二维码,C端的总二维码，可以区分堂食和外卖，" +
    public static final int RUN_MODEL_TYPE_TOTAL = 1;
    //   "2是堂食点单(自助快餐)，用于B端判断主页是否显示，" +
    public static final int RUN_MODEL_TYPE_QUICK_MODEL = 2;
    //   "3是餐桌二维码点单（餐桌上固定的二维码点单），" +
    public static final int RUN_MODEL_TYPE_FOOD_TABLE_FIX = 3;
    //   "4是服务员出单二维码点单（拼桌二维码点单），" +
    public static final int RUN_MODEL_TYPE_FOOD_TABLE_WAITER_QR = 4;
    //   "5是服务员外卖点单（控制B端主页外卖，以及餐桌列表外卖），" +
    public static final int RUN_MODEL_TYPE_TAKE_OUT = 5;
    //   "6是外卖平台点单"
    public static final int RUN_MODEL_TYPE_TAKE_OUT_PLAT = 6;

    //优惠卷类型
    public static final int DISCOUNT_TICKET_TYPE_CASH = 1;
    public static final int DISCOUNT_TICKET_TYPE_DISCOUNT = 2;
    public static final int DISCOUNT_TICKET_TYPE_AFTER_COST = 3;
    public static final int DISCOUNT_TICKET_TYPE_FREE_ITEM = 4;

    //营销任务状态
    public static final int MARKET_TASK_STATUS_ONLINE = 0;
    public static final int MARKET_TASK_STATUS_STOP = 1;

    //堂食
    public static final long ORDER_REPORT_TYPE_TANG_SHI = 1;
    //外卖
    public static final long ORDER_REPORT_TYPE_TAKE_OUT = 2;
    //外卖平台
    public static final long ORDER_REPORT_TYPE_TAKE_OUT_PLAT = 3;

    //微信
    public static final long PAY_TYPE_WEIXIN = 1;
    //支付宝
    public static final long PAY_TYPE_ALI_PAY = 2;
    //现金
    public static final long PAY_TYPE_CASH = 3;

    //barCounter kitchen
    public static final String PRINTER_LOCATION_BAR_COUNTER = "barCounter";
    public static final String PRINTER_LOCATION_KITCHEN = "kitchen";

    //    @ApiModelProperty(value = "打印机的状态，1是在线，工作状态正常，2是在线，工作状态不正常(一般是没有纸了)，3是离线")
    public static final int PRINTER_STATUS_ONLINE = 1;
    public static final int PRINTER_STATUS_NO_PAPER = 2;
    public static final int PRINTER_STATUS_OFFLINE = 3;

    public static final String TOUCH_DEVICE_REDIS_KEY = "touch.device.redis.key";

    public static final int DEVICE_STATUS_TYPE_PRINTER = 1;
    public static final int DEVICE_STATUS_TYPE_TOUCH_DEVICE = 2;

    public static final int DEVICE_STATUS_REASON_PRINTER_OFF_LINE = 1;
    public static final int DEVICE_STATUS_REASON_PRINTER_NO_PAPER = 2;
    public static final int DEVICE_STATUS_REASON_TOUCH_DEVICE_OFF_LINE = 3;

    //打印小票
    public static final long PRINT_FAILED_STATUS_PRINT_ORDER = 1;
    //打印排队信息
    public static final long PRINT_FAILED_STATUS_PRINT_LINE_UP = 2;
    //打印闭店报告
    public static final long PRINT_FAILED_STATUS_CLOSE_REPORT = 3;

    //    @ApiModelProperty(value = "支付类型,做报表统计用,1微信，2支付宝，3master Card, 4 visa,5现金")
    public static final int ORDER_PAY_TYPE_WEIXIN = 1;
    public static final int ORDER_PAY_TYPE_ALIPAY = 2;
    public static final int ORDER_PAY_TYPE_MASTER = 3;
    public static final int ORDER_PAY_TYPE_VISA = 4;
    //现金
    public static final int ORDER_PAY_TYPE_CASH = 5;
    public static final int ORDER_PAY_TYPE_APPLE = 6;
    public static final int ORDER_PAY_TYPE_GOOGLE = 7;
    public static final int ORDER_PAY_TYPE_BA_DA_TONG = 8;
    public static final int ORDER_PAY_TYPE_UNION_PAY = 9;
    public static final int ORDER_PAY_TYPE_AMERICAN_EXPRESS = 10;
    public static final int ORDER_PAY_TYPE_STRIPE = 11;
    //FooodPanda
    public static final int ORDER_PAY_TYPE_FOODPANDA = 17;

    //信用卡
    public static final int ORDER_PAY_TYPE_CREDIT_CARD = 12;
    //支票
    public static final int ORDER_PAY_TYPE_CHEQUE = 13;

    public static final int ORDER_PAY_TYPE_EFT = 20;

    public static final int ORDER_PAY_TYPE_DELIVERY_PLATFORM = 100;


    //第三方支付
    public static final int PAY_3RD_QF = 1;
    public static final int PAY_3RD_STRIPE = 2;

    public static final int SOCKET_TYPE_ORDER = 1;
    public static final int SOCKET_TYPE_SHOP = 2;
    public static final int SOCKET_TYPE_AUDIT_PRINT = 3;
    public static final int SOCKET_LINE_UP = 4;

    //订单查询类型
    public static final int ORDER_SEARCH_TYPE_TANG_SHI = 1;
    public static final int ORDER_SEARCH_TYPE_TAKE_OUT = 2;
    public static final int ORDER_SEARCH_TYPE_TAKE_OUT_PLAT = 3;

    public static final String USER_DEFAULT_PASSWORD = "*********";

    public static final int PRIVILEGE_SHOP_LEVEL = 3;

    public static final String LEADER_NONCE = "/leader/nonce";
    public static final String LEADER_LOCK = "/leader/lock";

    public static final String B_END_ONLINE_SORT_SET = "b_end_online_sort_set";
    public static final String C_END_ONLINE_SORT_SET = "c_end_online_sort_set";
    public static final String B_END_CACHE_REPORT_FLAG = "b.end.cache.report.flag";

    // @ApiModelProperty(value = "统计类型，1是C端设备连接数量，2是订单情况，3是实时订单支付数")
    public static final int CACHE_REPORT_TYPE_ONLINE_NUMBER_IN_C = 1;
    public static final int CACHE_REPORT_TYPE_ORDER_NUMBER = 2;
    public static final int CACHE_REPORT_TYPE_ORDER_PAYED = 3;

//    public static final int CACHE_REPORT_TYPE_ORDER_UNIT_NUMBER = 4;

//    public static final int CACHE_REPORT_TYPE_ORDER_UNIT_PAYED_NUMBER = 5;

    //C端用户锁定成功
    public static final int LOCK_ORDER_PAY_TYPE_OK = 1;
    //C端用户锁定失败
    public static final int LOCK_ORDER_PAY_TYPE_FAILED = 2;
    //已经被B端用户锁定
    public static final int LOCK_ORDER_PAY_TYPE_LOCKED_BY_WAITER = 3;

    public static final String APPLE_PAY = "Apple Pay";
    public static final String GOOGLE_PAY = "Google Pay";

    public static final String USER_SESSION_LOGIN_TIME = "user.session.login.time";
    public static final String SESSION_COMPANY_ID = "session.company.id";
    public static final String SESSION_B_END_LOGIN = "session.b.end.login";
    public static final String COMPANY_PRIVILEGE_UPDATE_TIME = "company.privilege.update.time";


    public static final long PRINTER_FAILED_TYPE_KITCHEN = 1;
    public static final long PRINTER_FAILED_TYPE_B_END = 2;
    public static final long PRINTER_FAILED_TYPE_C_END = 3;
    public static final long PRINTER_FAILED_TYPE_PACKING = 4;

    public static final Integer TICKET_NO_CREATED = 0;
    public static final Integer TICKET_GENERATING = 1;
    public static final Integer TICKET_GENERATED = 2;

    public static final String IP_BUSY = "ip.busy";

    public static final int SHOP_STATUS_CLOSING = 1;
    public static final int SHOP_STATUS_NORMAL = 0;

    //水平显示
    public static final int DISCOUNT_TICKET_DOWNLOAD_TYPE_HORIZONTAL = 1;
    //垂直显示
    public static final int DISCOUNT_TICKET_DOWNLOAD_TYPE_VERTICAL = 2;

    //服务费的CATALOG ID
    public static final long ORDER_CATALOG_SERVICE_FEE_ID = -1;
    public static final long ORDER_CATALOG_PACKING_FEE_ID = -2;
    public static final long ORDER_CATALOG_TAKE_OUT_DISCOUNT_FEE_ID = -3;
    public static final long ORDER_CATALOG_DISCOUNT_TICKET_FEE_ID = -4;
    public static final long ORDER_CATALOG_SPECIAL_ITEM_ID = -5;
    public static final long ORDER_CATALOG_CONSUMPTION_ID = -6;
    public static final long ORDER_CATALOG_TIPS_ID = -7;

    //1客人退菜，2库存不足，3服务员错误操作，4其它,用于做报表处理, 100汇总
    public static final long REASON_TYPE_CUSTOMER_RETURN = 1;
    public static final long REASON_TYPE_CUSTOMER = 2;
    public static final long REASON_TYPE_WRONG_OPERATOR = 3;
    public static final long REASON_TYPE_OTHER = 4;
    public static final long REASON_TYPE_TOTAL = 100;


    public static final int CUSTOMER_SEX_MALE = 1;
    public static final int CUSTOMER_SEX_FEMALE = 2;

    public static final int VIP_RENEW_YEAR = 1;
    public static final int VIP_RENEW_MONTH = 2;

    //按照消费的金额来算积分
    public static final int VIP_LEVEL_SCORE_EXCHANGE_TYPE_CASH = 1;
    //按照消费的次数来算积分
    public static final int VIP_LEVEL_SCORE_EXCHANGE_TYPE_ORDER_NUMBER = 2;

    public static final int SCORE_HISTORY_TYPE_ADD = 1;
    public static final int SCORE_HISTORY_TYPE_CUT = 2;
    public static final int SCORE_HISTORY_TYPE_MODIFY = 3;

    public static final int PERIOD_TYPE_YEAR = 1;
    public static final int PERIOD_TYPE_MONTH = 2;
    public static final int PERIOD_TYPE_WEEK = 3;
    public static final int PERIOD_TYPE_DAY = 4;


    public static final int CUSTOMER_TASK_TYPE_LEVEL_TICKET = 1;
    public static final int CUSTOMER_TASK_BIRTHDAY_TEMPLATE_TICKET = 2;
    public static final int CUSTOMER_TASK_TYPE_RE_NEW_VIP = 3;
    public static final int CUSTOMER_TASK_TYPE_MARKET_TASK = 4;

    public static final String CUSTOMER_LOCK_PREFIX = "customer.";

    public static final int TICKET_VALID_TYPE_TIME = 1;
    public static final int TICKET_VALID_TYPE_BINDING_DAYS = 2;

    public static final long SPECIAL_ITEM = -100;
    public static final String SPECIAL_ITEM_NAME_ZH = "特别菜";
    public static final String SPECIAL_ITEM_NAME_EN = "Custom Order";


    public static final int SEND_TO_KITCHEN_AUDIT_REJECT = 2;
    public static final int SEND_TO_KITCHEN_AUDIT_OK = 1;

    public static final long WAITER_LEADER_TICKET = -1;

    public static final String THREAD_LOCAL_VARIABLE_PRINTER_ORDER_ID_IN_C = "thread.local.printer.order.id.in.c";
    public static final String THREAD_LOCAL_VARIABLE_USE_USER_COST = "thread.local.use.user.cost";
    public static final String THREAD_LOCAL_VARIABLE_NO_NEED_WRITE_OPERATE_LOG = "thread.local.no.need.write.operate.log";
    public static final String THREAD_LOCAL_VARIABLE_STRIPE_TERMINAL_PAY = "thread.local.stripe.terminal.pay";
    public static final String THREAD_LOCAL_VARIABLE_PRINT_MERCHANT_COPY = "thread.local.print.merchant.copy";
    public static final String THREAD_LOCAL_VARIABLE_MODIFY_ORDER_PAY_TYPE = "thread.local.modify.order.pay.type";
    public static final String THREAD_LOCAL_VARIABLE_CARD_HOLDER_NAME = "thread.local.card.holder.name";
    public static final String THREAD_LOCAL_VARIABLE_CARD_LAST4 = "thread.local.card.last4";
    public static final String THREAD_LOCAL_VARIABLE_CONSUMPTION_FEE = "thread.local.consumption.fee";
    public static final String THREAD_LOCAL_VARIABLE_FE_CAL_PRICE = "fe.cal.price";
    public static final String THREAD_LOCAL_VARIABLE_USER_ID = "thread.local.user.id";

    public static boolean isOrderPayModifyRequest() {
        String s = ThreadContext.get(THREAD_LOCAL_VARIABLE_MODIFY_ORDER_PAY_TYPE);
        return StringUtils.isNotEmpty(s);
    }

    public static final String STRIPE_METADATA_TERMINAL = "terminal";

    public static final int SERVICE_FEE_ROUND_DOWN = 1;
    public static final int SERVICE_FEE_ROUND = 2;
    public static final int SERVICE_FEE_ROUND_UP = 3;

    public static final Long BY_AMOUNT_FIND = 1L;
    public static final Long BY_QTY_FIND = 2L;

    public static final String AUTO_CLOSE_SHOPID_TO_KEY = "AUTO_CLOSE_SHOPID_TO_KEY";

    public static final int FOOD_PANDA_MENU_TYPE_DELIVERY = 1;
    public static final int FOOD_PANDA_MENU_TYPE_PICK_UP = 2;

    public static final String FOOD_PANDA = "FoodPanda";

    //创建订单
    public static final Long CREATE_ORDER = 1L;
    //加菜
    public static final Long ADD_ITEM = 2L;
    //减菜
    public static final Long SUB_ITEM = 3L;
    //发送厨房
    public static final Long SEND_KITCHEN = 4L;
    //撤销订单
    public static final Long CANCEL_PAY_TYPE = 5L;
    //订单支付成功
    public static final Long ORDER_PAY_OK = 6L;
    //分钱,按照人数
    public static final Long PART_CASH_PERSON = 7L;
    //按照分钱，自定义
    public static final Long PART_CASH_MONEY = 8L;
    //进入分菜结账
    public static final Long PART_FOOD = 9L;
    //退款
    public static final Long ORDER_RETURN_CASH = 10L;
    //打印订单
    public static final Long PRINT_ORDER = 11L;
    //更换支付类型
    public static final Long CHANGE_PAY_TYPE = 12L;
    //分菜的时候菜品移动
    public static final Long MOVE_ITEM_TO_SUB_ORDER = 13L;
    //进入分钱结账
    public static final Long TO_PART_CASH = 14L;
    //同意落单
    public static final Long AGREE_BE_ALONE = 15L;
    //拒绝落单
    public static final Long REFUSE_BE_ALONE = 16L;
    //删除订单
    public static final Long DELETE_ORDER = 17L;
    //打印厨房订单
    public static final Long PRINT_KITCHEN_ORDER = 18L;
    //开台
    public static final Long OPEN_FOOD_TABLE = 19L;
    //取消开台
    public static final Long CANCEL_FOOD_TABLE = 20L;
    //订单失效了
    public static final Long ORDER_EXPIRATION = 21L;
    //进入全部结账
    public static final Long USER_ALL_PAY = 22L;
    //搭台
    public static final Long TAKE_FOOD_TABLE = 23L;
    //转台
    public static final Long MOVE_FOOD_TABLE = 24L;
    //c端确认落单
    public static final Long CONFIRM_ORDER = 25L;
    //清空购物车
    public static final Long CLEAN_ORDER_ITEM = 26L;
    //减少落单审核里面的菜
    public static final Long SUB_AUDIT_ORDER_ITEM = 27L;
    //删除落单审核里面的菜
    public static final Long DELETE_AUDIT_ORDER_ITEM = 28L;
    //更新了购物车
    public static final Long UPDATE_ORDER_ITEM = 29L;

    //分钱按金额分，创建子订单时达，已创建了19个
    public static final int PART_CASH_MONEY_CREATE_SUB_THRESHOLD = 19;

    //公司geo数据key
    public static final String COMPANY_GEO_KEY = "company:geo:";

    public static final Integer SHOP_SEARCH_ITEM = 1;
    public static final Integer SHOP_SEARCH_CATALOG = 2;
    public static final Integer SHOP_SEARCH_PAY_TYPE = 3;
    public static final Integer SHOP_SEARCH_WAITER = 4;
    public static final Integer SHOP_SEARCH_DELETE_ITEM = 5;

    //打包费，小计的比例
    public static final Integer PACKAGE_FEE_PERCENT = 2;
    //排队二维码告示
    public static final String QUEUE_QR_BULLETIN_ZH = "掃碼查看排隊信息";
    public static final String QUEUE_QR_BULLETIN_EN = "Queue QR Code Notice";

    //临时二维码告示
    public static final String ORDER_QR_BULLETIN_ZH = "掃碼點餐";
    public static final String ORDER_QR_BULLETIN_EN = "Serve End QR Code Notice";
    // 1 固定打包费设置
    public static final Integer PACKAGE_FEE_FIXED = 1;

}
